package com.svse.designPattern.behaviour.state.impl;

import com.svse.designPattern.behaviour.state.context.ScoreContext;
import com.svse.designPattern.behaviour.state.service.AbstractState;

/**
 * @author LiYuhang
 * @version 0.1
 * @application
 * @Date 2020/8/8 11:23
 */
public class LowState extends AbstractState {
    public LowState(ScoreContext h)
    {
        context=h;
        super.stateName="不及格";
        super.score=0;
    }
    public LowState(AbstractState state)
    {
        context=state.context;
        stateName="不及格";
        score=state.score;
    }
    @Override
    public void checkState() {
        if(score>=90){
            context.setAbstractState(new HighState(this));
        }else  if(score>=60){
            context.setAbstractState(new MiddleState(this));
        }
    }
}
